package org.wevil.controller.sys;

import com.alibaba.fastjson.JSONObject;


import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wevil.util.HttpUtil;
import org.wevil.vo.Result;

@Validated
/** 天气 */
@RestController
@RequestMapping("/weather")
public class WeatherController {

    /** 获取博湖天气 */
    @GetMapping
    public Result<Object> page(){
        // 城市代码查询地址：https://www.sojson.com/blog/305.html
        String uri = "http://t.weather.sojson.com/api/weather/city/101130612";
        String result = HttpUtil.doGet(uri, "UTF-8", null);
        Object data = JSONObject.parse(result);
        return Result.success(data);
    }
}
